package cn.nbs.book.web.servlet;

import java.util.List;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.com.hkr.servlet.BaseServlet;
import cn.nbs.book.entity.Book;
import cn.nbs.book.service.BookService;

@WebServlet("/BookServlet")
public class BookServlet extends BaseServlet {
	private  BookService service = new BookService();
	
	public String findByCategory(HttpServletRequest request,HttpServletResponse response){
		//通过request获取cid
		String cid = request.getParameter("cid");
		
		List<Book> list = service.findByCategory(cid);
		
		request.setAttribute("list", list);
		
		return "f:/jsps/book/list.jsp";
		
	}
	
	public String load(HttpServletRequest request,HttpServletResponse response){
		String bid = request.getParameter("bid");
		Book book = service.load(bid);
		request.setAttribute("book", book);
		return "f:/jsps/book/desc.jsp";
	}
	
	
	
	
}
